#include "iot_gpio.h"
#include "iot_pwm.h"
#include "stdio.h"
#include "iot_gpio_ex.h"
#include "stdint.h"

#define MOTOR_GPIO_IDX 2
#define MOTOR_PWM_PORT 2

void motor_control(uint8_t speed){
    int ret = 0;
    switch(speed){
        case 0:
            ret = IoTPwmStop(MOTOR_PWM_PORT);
            break;
        case 1:
            ret = IoTPwmStart(MOTOR_PWM_PORT,2,400000);
            break;
        case 2:
            ret = IoTPwmStart(MOTOR_PWM_PORT,3,400000);
            break;
        case 3:
            ret = IoTPwmStart(MOTOR_PWM_PORT,4,400000);
            break;
        default:break;
    }
    // printf("pwm start ret = %d\n",ret);
}

